# coding=utf-8
class Solution:
    def intToRoman(self, num: int) -> str:
        roma = ''
        q = num // 1000
        if q:
            for i in range(q):
                roma += "M"
        b = num % 1000 // 100
        if 1 <= b < 4:
            for i in range(b):
                roma += 'C'
        elif b == 4:
            roma += 'CD'
        elif b == 5:
            roma += 'D'
        elif 5 < b < 9:
            roma += 'd'
            for i in range(b - 5):
                roma += 'c'
        elif b == 9:
            roma += 'cm'

        b = num % 100 // 10
        if 1 <= b < 4:
            for i in range(b):
                roma += 'x'
        elif b == 4:
            roma += 'xl'
        elif b == 5:
            roma += 'l'
        elif 5 < b < 9:
            roma += 'l'
            for i in range(b - 5):
                roma += 'x'
        elif b == 9:
            roma += 'xc'

        b = num % 10
        if 1 <= b < 4:
            for i in range(b):
                roma += 'i'
        elif b == 4:
            roma += 'iv'
        elif b == 5:
            roma += 'v'
        elif 5 < b < 9:
            roma += 'v'
            for i in range(b - 5):
                roma += 'i'
        elif b == 9:
            roma += 'ix'

        return roma.upper()


a = Solution()
print(a.intToRoman(2079))
